package com.yanze.schoolinformation.view.login_register;

import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.yanze.schoolinformation.R;
import com.yanze.schoolinformation.databinding.ActivityLoginBinding;
import com.yanze.schoolinformation.utils.statusbar.StatusBarUtil;
import com.yanze.schoolinformation.view.login_register.login.LoginFragment;

public class LoginActivity extends AppCompatActivity {

    private ActivityLoginBinding databinding;
    private FragmentManager manager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        databinding = DataBindingUtil.setContentView(this, R.layout.activity_login);
        StatusBarUtil.setTransparent(this);
        initView();
    }


    private void initView() {
        LoginFragment loginFrg = new LoginFragment();
        if (manager == null) {
            manager = getSupportFragmentManager();
        }
        FragmentTransaction transaction = manager.beginTransaction();
        transaction.add(R.id.fl_contant, loginFrg);
        transaction.commit();
    }


    /**
     * 入口
     */
    public static void start(Context context) {
        context.startActivity(new Intent(context, LoginActivity.class));
    }
}
